#!/bin/bash

permission::has_read_permission() {
  path=$1
  if [ -r $path ]; then
    return 1
  else
    return 0
  fi
}

permission::has_write_permission() {
  path=$1
  if [ -w $path ]; then
    return 1
  else
    return 0
  fi
}

permission::has_execute_permission() {
  path=$1
  if [ -w $path ]; then
    return 1
  else
    return 0
  fi
}

permission::has_permission() {
  if [ -r $path ] && [ -w $path ]; then
    return 1
  else
    return 0
  fi
}

export -f permission::has_permission
export -f permission::has_read_permission
export -f permission::has_write_permission
export -f permission::has_execute_permission
